now using $on and $broadcast instead callbacks; and added logout