Refactored the application to use MVVM pattern