system_login function separated