Added tests, and minor code changes