Boundary and corner terms in the action for general relativity