Better error handling; Added custom errorHandler middleware