updated logic for handling private functions