cleanup request parsing code