refactoring middleware to only expose middleware specific properties