Correct two logic errors, formatting.