Refactoring of middleware to use String urls.

Refactoring of middleware to use String instead of URL