added if to find new repo and split out the $where