Fixed memory leak
Cleanup, fixed freeing of input streams, stop current search if a new search is triggered