fixed algorithm, still no ui