Removing unneeded instructions