Refactored if statement to ternary outside of function
Testing refactored code