Started on fixing bug where elements are not closed