Modularized the code to have separate threads for hand and the arm