Cleaned up request parsing code.