Added query page
Moved most of the stuff in the main into a router module

This is less to split things up and more to make sure things are well
named