Various changes

Select only "completed" results.
Added sendCommand function.