Cleaned up the code a tiny bit and tested it on sentiment data.