Simulation now works. TODO: phase/ratio control