Congestion Avoidance, Detection and Mitigation in Wireless Sensor Networks