A few UI fixes; improve tab complete algorithm