Refactor split into client and server, might be useful elsewhere
add another query type (unimplemented)
update router main