Some code for pre processing