Deleting duplicate code