Hg 69 use one api

There is still some cleanup to do
but maybe you can already spot something that I did that needs to be fixed
@kenkouot @benmai 
I would consider using early returns and testing for falsy conditions to minimize nesting