use an expander instead of hand-crafted code

Change-Id: Id5606051656f21309c9e5c8d08a2eacd65b22dbf