Remove functions that will be replaced by JSON output
Rename variable
Assign integer at loop
Use proper type