popple: remove duplicated code