adding working middleware