Implement greedy routing and also other utility parts.