refactored util