Restructure, define new function, to remove gotos.
Header consistency, notes for later