tweaked the patch and the arduino code