Use better query for determining locked processes, allow one process
to report multiple lockers its waiting on.

Some minor formatting fixes.