added conditional at the top of script to account for remote execution