added some combinatorics