Refactor simulator and write tests for it
current state:
Simulator input and output hard to test
required:
Make a function which gets input and output clearly functional. Easy to test.