Optimize for SensorTag battery lifetime

Hi Ian,

Thanks for sharing this code, great stuff!
I've made some optimizations to decrease battery drain and make queries faster.

Cheers, Peter