Added caching for various util functions for performance