More elegant solution to class lookup problem.