Refactor models and node_api

Maybe this line could get a little shorter.