register command and listener into the main thread