Rewrited to more logic form.