rough implementation of bpmapply