Added code for power up and power down