better performance

known problems: goto, sync