remove dupplicated code