add options argument and two callbacks