Added debug stack and more state checking for a cleaner debug experience