Some more optimization of headwords retrieving