Added method to load middleware