refactor to helper