compleated function implementations.