Issue #1 - implement state stack