Added cleanup function.
-O3 gotta go fast