Updated api to make script statless