Added a check() function