Move image loading code to utils class