added $table variable