reduce indentation and generally simplify code, no functionality change.