Refactored structure of view controller