added caching for materials