Combined functions where possible

Also added ability to add and remove the main container.