Added write word function