add on_signin. better code structure and doc