cleanup dupicate code