Updated application_helper with refactored code and improved variable naming.