Refactor getValue into getValue and formatValue

Include a method for when data is null, formatMissingValue.