Reorder functions
Improved cycleSizes function & made reusable