added checkfor function