Added 'check' function