refactored to phantomJS