Code refactored
Bluetooth issue fixed