removing dublicate code