improve authenticate