login code moved to coroutine partly