Debugged refactored code