refactored utilties