Adding logs and completing function