Refactor/generalize code for generating detail box contents.