Would love to gut a lot of the code from here to the end of the file- I'm not convinced we need to do as much data-juggling as we are. Not necessary for this PR though