Some script and functions