Fix test implementation
Cleanup; refactoring