decouple code from models into api