Addressed all code review issues, added tests