Script to pre-process data