solve exercise 8: refactoring with "parse_request" method