Update state-machine.js

Added last property and was() function