see comments above about the convenience of moving this function to some utilities source file