Added optimizations

- Cache images
- Avoid using setRGBA() excessively