Renaming constants to convey intent clearly

.. and moving locals logic into a helper,
so that we don't have to pass locals around
to detect the diff view.