refactored app.xaml.cs