Added tests, broke into packages, added comments