added global middleware