Add save game functionality and error checking