Apple Smart Battery sensor fix by RehabMan. Refactoring.