moving duplicated code to common
moving duplicated code to common