Modified to include pre-computation of images/textures.