Fixing whitespace and code re-use