cleaner query return construction, done in function