Removed the reversal step from the algorithm