added more tests.
clean dead code.