Fixing code review feedback and adding tests for more code coverage