misc bug fixes for router, first 'working' implementation