First commit, hopefully made it work.

This is **NOT** ready for production use, and is probably rather buggy.