renamed "table" to "instance" to resolve mysql keyword conflict
more changes to move table to instance