I think this check should only be done once, when the file is loaded, instead of each time run is called