Added withEncoding method