modified prepare.pm