Installing and setting up the rewire function