finish rewrite controllers and models