Refactor, move option handling for executeJavascript into method itself