Setting up state stack