snapshot() function added