refactor utils