Accidentally ruined save function, now fixed
Several improvements and fixes