Restructure of code, bugfixes, start adding tests

can't you avoid using relative imports? you know what will happen if you refactor again :-/