Start of code rework (initial restructure)