Moved formatting functionality into client/data_formatting.h

Add some more tests as well