refactor utilities