Refactoring, many new features, JSON output