reworked to use json