Speed up of Expand function (Hermes)