An explicit Hamiltonian formulation of surface waves in water of finite depth