Implemented basic simulation logic. there's a good chance that there are
still a couple of bugs and/or race conditions