added function and script