wrote directlyConnected and updateHairpinSpace methods