function changed to run instead of openfig