refactor a couple methods