wp8 code refactor