implemented log in code