Add support for specifying the output length