Check function now seems to work