Code cleanup, fixing few warnings, json parsing error reporting