Split main into seperate function for ShapeSorter.