Better order of class existence check [closes #27]