Move line shifting into a separate method