trying to optimize code & workaround lack of "gosub"