adding tests and address code review comments