cleaned presence function