Refactoring; remove redundant function.
refactor; add descriptive comment and refine variable names
Refactor; move duplicated logic from minvStep to sweepBy