Periodic battery checking.
Cleanup of code.