changed code to use xCommandListener and xCommandEvent classes
added missing steps 1 and 8