Refactored the code, added saving of Player's variables.