Refactored code to relevant function names