Changed cudQuery() to writeAll()