improved
lot of bug fixes and improved usage of test framework