Improvements, cleanup and fixes.