Refactor a util module