added query mechanism, routes and external files