Code refactoring, add tests to blockService