Added (untested) image loading logic.