cleanup, add tests