Moving utility functions into utils