Created a cleanup function