Modify util module

The module has been significantly cleaned with several functions not
useful anymore removed. Now it just contains quite a few functions.