Refactored large method