more magic, now detects if it is being run or required