refactor and correct response