Updated to use the MVVM design pattern