Improved topology parsing