scripts - main, functions