Complete structure rework

fixed all functions with the new table and other difficulties