Refactor the code to be a category on UIDevice, modernize to use ARC and abandon deprecated APIs when possible