implementing code formation on search