Refactors logic to extracted methods with better readability