Tighten types of rewrite rule applications, other simplifications