Added model based API

https://docs.google.com/document/d/13v9TF56gqykSyg0uysIzeZlEQmJL5ge5wLfM-uRaAwo/edit#