Progress on preprocessing function