Implemented cleanup for elements