add more tests and correct mistakes