Assign proper IDs to element panels; code cleanup.