speed up preprocessing