removed dead code.
added more tests.