Code cleanup
Added back automatic URL detection which was accidentally removed during debugging