Finally fixed the battery percentage change tracking (and taking samples based on that). Now it works flawlessly.