Tidy up lookup_class