Moving common functions into utils