Refined URL detection - fixes #36