Do not reference document in functions