Some more work for Avi save feature, yet to be tested