lowercasing and trimming command inputs, minor changes

parseInt (primitive) preferred over valueOf (object)