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
Merge pull request #791 from janhancic/develop-convert-util-to-commonjs

Update the `util` lib to CommonJS style