Sorting objects

Moved standalone variables into objects for easier tracking and control. Also standardized some formatting,