Add/improve comments
Extract generic parts of SnapshotStateMachine into generic base class
Use macros to improve readability
Document the generic state machine base class