class detection improved