Changed wc to use malloc