Added json output.
Removed dead code.
Removed unused imports.