Functioning loginfunction.