All sorts of refactoring, implemented some createJson* functions in cyvws