Refactored into more files, understood more about how the system works. I realized that mallocing inside cuda is probably a very bad idea in the first place, and I'll try to refactor to get rid of it.
Successfully removed dependency on malloc.
Fixed a typo in simulator.py