Fixed number format exception and tested for valid commands