Refactoring

Hi, as commented on the other issue I rebased my branch and added comments / unified the tests and directories.
This would be the pull request. I didn't notice you were working on the same thing, so that's a bit messy now I guess, I'm not sure what exactly you merged. If everything is ok, feel free to close this. I'll look into this again in the evening when I have some free time.