added a check for completion