Refactor from view controller