Refactoring of router_interface

While I was learning how this all works I found the router interface a bit hard to read... This is just a refactoring of this file, to make it easier.