fixed the write command. It now actually writes what it is supposed to. Didn't put memmove() in the write function.