Added functions check/2 and format_error/2