fixed dupplicate code