refactored successfully