added code for the removal of duplicate