Update the `util` lib to CommonJS style

- update all files in the `util` lib to be written in CommonJS style
- change `util` tests to use `require()`s instead of namespaced style code
  to referer to classes
- fix `services` tests because of bug #782