Move 'snapshot' method to a standalone function.