Cleanup and some fixes.