Refactor so that phantomjs-script is also an option