adding save in file and making counter serializable.