Optimize helper functions