Fixed bug in simulator
Moved simulator into npm library