Rewrite as MVC