Change the class selection process

Part of fixing #410