refactor to single responsibility