Added middleware
Improved resilience
Updated sample config file