Added the dispose functionality