Small middleware refactor

The "all" middleware hook made implementation more complicated and brittle than it needed to be. Closes #96