Moved sentiment analysis code into separate methods.