added in some flow control to ensure that scripts are only run if present in directory