more improvements to topological mapper, finally getting a hang of properly writing this code