Move function into utils package