Add command logout, sync and clear #89

Clear command still has concurrent modification problem