Some more fixes and cleanup.