json stuff, moved rendering function