Remove commented code
JSON decode as object, not array
Refactor post requests into separate function