Enchanced JSON-generator + several minor fixes