final changes to commandAdd for sorting