refs #4 refactoring done, started with testcases