parseJson now gets data as paramater
Optimized parseJson for loop
Added comments