Fixed for compilation, tweaked a few classes.