decoupling code and update model_spec