used memcpy instead a for loop