Changed login to use sessions