middleware support
Better error messages