Add comments and format code