Code cleanup, change type handling for JSON, increase buffers size