Refactored codebase for 2.0