Implemeted smart errors for task 4