finished log in and log out fuctionality