refactoring a map related method & add moment.js for datetime