Added call to clone() to avoid unexpected change to external data.