Restructured blocks and items and more code cleanup