ref: extract common part