Refactor the code in 'enb.js'