Change API to make setting callbacks more flexible.