Code refactored; 3 main objects, indentation converted to spaces