plumbing for api. not tested