Continued refactoring for easier debugging, specifically chaning most struct pointers to references and moving simulation related functions from main to sim, as well as breaking up functions into more easily testable fragments