Wrote the initial portal expander function