Moved all the logic to ViewModels