add more tests and cleanup