remove some goto code