Adding some basic code (untested) for Avi save feature