code review & cleanup
updated tests