starting to restructure json handling