finished inital snapshot code with cdb support