Big refactor in prep to add new machines.