Improving the image mgr code