Add homology check as final step in strategies. Also a bunch of refactoring.