Tidy up double-sided code

simplify code by removing redundant variable, and match code formatting
to the rest of the source