Refactored out data logic out of homeviewcontroller