avoid duplicated code