Lastsnapshot function added