 
   /** private */
   _getKeys = function (name, filter) {
-    var sql = "SELECT _pk FROM %I ",
+    var part, order, op, err, n,
+      ops = ["=", "!=", "<", ">", "<>", "~", "*~", "!~", "!~*"],
+      sql = "SELECT _pk FROM %I ",
       tokens = [name.toSnakeCase()],
       criteria = filter.criteria || [],
       sort = filter.sort || [],
       params = [],
-      ops = ["=", "!=", "<", ">", "<>", "~", "*~", "!~", "!~*"],
       result  = [],
       parts = [],
-      part,
-      order,
-      op,
-      err,
       i = 0,
-      p = 1,
-      n;
+      p = 1;
 
     /* Only return values if we have a filter */
     if (filter) {

      oldObj = JSON.parse(JSON.stringify(ary[i]));
      newObj = {};

      for (key in oldObj) {
        if (oldObj.hasOwnProperty(key)) {

          /* Remove internal properties */
          if (key.match("^_")) {
            delete oldObj[key];
          } else {
            /* Make properties camel case */
            newObj[key.toCamelCase()] = ary[i][key];

            /* Recursively sanitize objects */
            if (typeof oldObj[key] === "object") {
              newObj[key] = oldObj[key] ? _sanitize(oldObj[key]) : {};
            }
          }
        }


  /** private */
  _createView = function (name, dropFirst) {
    var parent, alias, type, view, sub, col, key,
      klass = featherbone.getClass(name),
      table = name.toSnakeCase(),
      args = ["_" + table, "_pk"],
      props = klass.properties,
      cols = ["%I"],
      sql = "";

    for (key in props) {
      if (props.hasOwnProperty(key)) {
