clean up the code and add a batch of useful tests
Merge pull request #19 from SIMS-Topaz/aja/add_tests

clean up the code and add a batch of useful tests