Converted Alexs keypad code into a C++ class in a thread