Update to use the global $, document