Massive update: many new features and refactorings