simplified the class check