Refactored utils