updated version of favorites function