fixes #3. Offloaded some stuff into seperate files.
Organize a little bit better.