completed user login etc functions