Remove manual memory copy