Refactoring to ViewController