Updated check function