split functions into two parts