An improved model for hydrogen trapping in metals