Added functions check/2, parse_and_check/2, and format_error/2