Fix match error found by dialyzer
Fix for textbox autocomplete and some refactoring