Rewrote typeWrite function