streamlined the program, better URL detection