Cmd fix to remove dups and improve performance