Added some debugging middleware