improved handtracking code