updates to code and added testing suite