Refactor to View Model