move commonly used functions into utils