added cleanup function