changed object to function