final cleanup of code