Changed login flow and added logout option