Cleaning up a huge ruby application

Refactoring