Cleaned up logic for the container class and added subcontainer handling to render collapsible.