refactoring the output of values and foreign keys at the client