Lots of changes as per IRC and last pull request

I moved the source files to proper directories, made a nice CMake project and fixed SCons.

Please don't just close the pull request this time! I can still append commits to this pull request and do not have to make a new one.