done but with minor errors in log operation