refactored utilities