try to remove some duplicative code