separate the common functions