Improved helper functions