Added pre-sorting by part.