update style; fix many bugs