Copied over phantomjsify from proof of concept