refactoring and parse_response function start