Add heandler for thread communication