added some middleware