update goto statements and general flow of script