Move sort algorithm into own type
Refactor CLI flags and parser