Some refactoring and bugfixes. Added the Testsuite.