Changed the code to route based on prepended destination header. Also fixed a few bugs