refactor to one common method