more unit tests and bugfixes
Worked on __main__ a bit