smartdd: massive rewrite.

Using threads instead of process.