Refactoring of utils. Tests not updated yet