Put general functions in lib/util.js