Fixing off-by-one error in ex2, and shortening ex3