Remove all unneeded pairs for better performance