performance optimizations with images