Changed localization to falling edge and formatted some code