Change loop to correct output ordering
Remove unneeded trimming
Added steps to the algorithm and updated benchmarks