add battery sensor
cleanup code