add tests and fix other stuff