Added support for a before and after callback to be able to hook in
custom middleware