saving progress, still need to be debugged