refactor to separate method