move entity CAPI to of_entities, rename some functions, won't touch this much anymore