updated save function signature