Pushed refactored logic.