added test suite, and made changes based on test results.