changing the script from outside to the layout