Added smart and autocomplete functionalities and optimalisation