finished middleware