Big refactoring to make easier to read & work with externally, and more typesafe (Lists/Maps -> Tuple5s)