Remove unwanted values and minimise key lengths