Pull some stuff out to their own classes.  Fix some bugs.