Structural code updates and fixes