replacelivewithonfunction