reduced duplicated code