adding loggin function