Moved ahead/behind code directly in to prompt code to save on detecting the branch multiple times.