optimized code (moved images to sprite)