massive rework of coding philosophy to use traits and case classes