Split makeClassTable into more modular functions.
Needs some cleanup work, but it will work for now.