Code coverage improvement + refactoring tests

Changes:
* Improved code coverage
* Refactored tests