Refactor some code from model/wallet to model/pocket/hd