Huge overhaul to tableize script