Added documentation
Better documentation, and small fix on double triggering state event