General refactoring and added the swatch analyzer.