refactored code for xamarin android