Re-organizing utils

I have unified two files from `utils` folder in the same file (`utils.py`) and I have done all the updates in other modules and tests. Also I made a tweak to `utils.esum` function.

Sorry for the second commit.