changes made to script to get fully working