add tests and refactor to prepare for new features