added flag to prevent multiple searching