breaking up the script into functions and adding the ability to set the signal regardless of test order