Refactored HomeViewController code.