Fix dameon handling and BAT_GOOD calculation

Fixes issues discussed over email:

- BAT_GOOD calculation was rounding down values to nearest integer, so in some cases BAT_LOW and BAT_GOOD were the same value (and in all cases BAT_GOOD was lower than it should have been)

- daemon handling meant that it could start a deamon even if it was already running, and also it wouldn't properly kill a process in a bad state

See separate commits for more details, and test logs.