Refactored code structure

Hi,

to learn your framework inside-out before starting to use it at work, I've refactored it quite heavily. If you've got some time to look at my changes and like them I'd be honored to see them merged. Please don't hesitate to ignore the pull request if you don't - my primary reason to refactor it was to familiarize myself with the framework.