Refactored detail view controller according to jspahrsummer's suggestion.