Tidy up and unify coding style.

Remove spaces inside brackets, add spaces around operators, etc.