improves the arduino mega sketch