Refactor of utils