Method seperateTables and some helper methods added.