Added unit tests
Applied scrutinizer-ci advice