functions refined