Refactored code for WP8 client