abstract out format.js
fix style