Added support for multiple tables. Scope creep...