continued recast the login algorithm