FiGaRo: Fine-Grained Software Reconfiguration for Wireless Sensor Networks