Complete reestructuration of classes and code