fix undefined variable
cleanup whitespace
improve docblock
define private variable _tables