Cleanup and semantic fixes.