Unify task scan functions.
Reimplement scan command for webui.
Remove legacy code.