add tests and some functionality