save function ready for use with Rhino Please do not change the logic of the save function without further notice