fixed json and added for loops