Account for empty result set and update getPreparedQuery