cleanup function and remove unused param