Increased test coverage and remove dead code.