cleanups, removed dead code
added test case