Optimize codes of retrieving redundancies