Move the class parser into a function
Resolve class indices before lookup segmentation
Move the lookup printing code into a function
Rename few lookup-related variables