refactoring in blog.js