Refactored. Made a bunch of methods private and removed unused code.