optimize & format code