first checkpoint for the save function almost fully working