Oh I wonder why I haven't thought about that since my complicated games were structured like that in Game Maker too except for that I didn't make state variables but jumped to different rooms it was easier that way. Now it's the same concept just a bit different method. And I always keep my code in order. Mostly it's because me and my friend occasionally show each other our programs and we must write them in a way easy to understand for the other too. So usually it is full of comments and I go one tab inside after every begin or repeat.