refactorizing the code, updating the firmware