add tests and change functionality