Tests: Code refactoring