Moved middleware off from options

...So it can't be overwritten by accident
Also, cleaned up a bit