We should not make this global "p" variable. Maybe wrap this whole section in a `(function () {..}())`?