major routing functionality. Should have commited a long time ago