use seq_len(foo) instead of 1:foo