move function to viewController