edited parts of SQL script