Restructured classes and api