rearrange code to make room for portal