Expansion of logic

Also added some classes.