increased buf size to 200 to fix an unintentional bug and removed useless loop