Used memcpy instead of for loop