Working code to deal with Microsoft Live