Reorganized into object-oriented structure

I saw your comment about wanting to extend the project, so I spent some time this afternoon cleaning up the structure, consolidating some of the logic and making it class-based. Let me know what you think!