finalize refactoring