refactoring blog.js.