Spread out some of the core code into separate files -- it was getting too complex to keep together. Also got plugins implemented.