cleanup and console logging