refactor adn function support