move middleware to main app namespace