fix bug in model, and separate wordcounts.js