First part of login procedure