added check to run only when script called