got rid of some gotos