removing some duplicated code to a super class