Are gotos really the best solution for this?