Changed login func added logging