moved around code in topology.h
tests pass