cleanup and performance timing