Added more stuff for popups and substates