rewrite the models