refactored use of phantomjs native require()