Removes unneeded typechecks.