add tests and clean up usage