Reorganized utility functions