added json for the common function
few modifications