compare functions more general