format code, add logs