autocomplete improvements + code cleanup