fixed searching algorithms, better debugger