Spain moves to regularize more than 500,000 undocumented migrants