Refactor return logic to simplify
Refactor common functionality into separate task
Fix magic numbers :)