added a few new tests and refactored code