now creating save current state func
now creating save current state func