NXT code with threading