Here is the solution for button delay, and disconnection problems