Update invoke.js

small updates to clean up the if/then statement  Pete