refactored into hb.js