Latency reducing algorithms for wireless sensor networks