re-formats some code, simplifies calls using InvariantEquals extension method