remove var arrays and add a few parens to please microsoft's compiler