incorporating some more PR feedback and adding/updating unit tests