I think you can create functions in the code and if certain condition is true you can just call the function instead of using goto.