combined the 2scripts in p1