Added further test coverage with unit tests for functions