Remove console.log's and replace with emit error events.