cleaned up creation of json