made functions more re-useable