Changed query API to return int instead of bool status