added checkstatus function