Save time in preprocess by reducing map lookups and sorts