Generic utility functions