adv function edited