added saveFinalImage
merged and conflict resolved