added request handler, refactored routing