external api: replace some pointers with references