Added some basic middleware handling and more docs