Removed extraneous code from check function