Added state stack for transitions