Middleware execution for the command module