Cleanup; refactoring