copying traffic's middleware
better middleware