code review -> better parameter validation;  fix cancel search