I've written a series of 8 tests covering the rules listed above as well as an implementation that lives in Utils, instead of inlined in the renderContact function