Cleanup and various improvements.