Compressed regex and refactored response code