Refactoring / purification

Figured we should start a pull request for this. All that remains is some documentation and, perhaps, renaming source files and restructuring folders. Would be good to be back on master.