Changed system of error handling