add tests and improve readability