added testcases

+ improvements