Adding function sendError