Clean ups and adaption to new IDE
Added check to prevent saving of empty image.
Added local disk cache to speed up image loading