Extensive rework of classes and start adding in registration function