added recordLength parameter