Text this: A multilayered algorithm for topology control and self-healing on Wireless Sensor Network