Added routing loop logic, fixes to output parsing.