Tweaked AnalysisEngine a bit, cleaned up quite a bit, and added some comments.