moved import into take_snapshot function