implemented saving game functionality.