Optimize the classes cache hack.