cosmetic js changes and get graph as json function