creating a script for arranging data tables