finalising login/logout functions