Massive code refactoring and cleanup to support static and interactive visualizations. Not done yet but it's stable again