added middleware package for allowing better code reuse