Reorganized a bunch of stuff to hopefully fix an issue