Login function cleanup