add dot output. Algo is buggy.