Restructured code to separate functionality into classes

Let me know if I overdid it... lol