refactored to add main method, added change of quarters logic