created callback hierarchy that avoids evil globals