It is described how the standard Poisson bracket formulas should be modified in order to incorporate integrals of divergences into the Hamiltonian formalism and why this is necessary. Examples from Einstein gravity and Yang-Mills gauge field theory are given.