I would suggest to lowercase these agent strings in the code, thereby we could get rid of the strtolower a in line 409