Added error type for function addWord