Corrected memory argument check
Added import from xml functionality, corrected find_image_format procedure