Improve URI parsing