Refactor giant method