relocate common functions