small additions and modifications

added cmd string function to avoid long strings in the connection
argument