Many changes and fixes.