Refactoring to send return code and return message. Modified to return after sending response.