Sending 200 or 500 based on result