Use more flexible method of determining output length, by setting &outlen