created script and functions