Modify prestart script and main