Refactor snapshot hook; make sure repositories are passed