Added buffer searching function