Refactored the statusCode ternary operator