Refactored complex method