Use handlers for routes.

Replaced mounted middleware for route handlers.
Added debugging capabilities.