updated script with comments